﻿

namespace ServerBase.Config
{
    /// <summary>
    /// 系统配置
    /// </summary>
    public static partial class Conf
    {

        //服务器列表	// F_服务器配置.xlsx
        public static Dictionary<int, ConfigServer> ConfToolServer = new Dictionary<int, ConfigServer>();
        public static Dictionary<string, ConfigServer> ConfToolServerExt = new Dictionary<string, ConfigServer>();

        // 初始化配置文件
        public static bool InitConfSystem()
        {
            bool result = true;

            //服务器列表
            if (result) { result = ReadConfig(typeof(ConfigServer).Name, ref ConfToolServer); }
            ConfToolServerExt.Clear(); foreach (var item in ConfToolServer.Values) { ConfToolServerExt[$"{item.ServerName}"] = item; }
            ConfToolServer.TryGetValue(SvInfo.ConfigId, out var cfg);
            SvInfo.Cfg = cfg ?? SvInfo.Cfg;

            return result;
        }


    }
}